﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraController : MonoBehaviour
{
    private Vector3 _keyDownPosition;
    private bool _mousePress;

    // Use this for initialization
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            _keyDownPosition = Input.mousePosition;
            _mousePress = true;
        }
        else if (Input.GetMouseButtonUp(0))
        {
            _mousePress = false;
        }


        if (_mousePress)
        {
            var delta = Input.mousePosition - _keyDownPosition;

            transform.RotateAround(Vector3.zero, Vector3.up, delta.x * 0.01f);
        }
    }
}
